/*
* Copyright (C) Microsoft. All rights reserved.  
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not 
* use this file except in compliance with the License.  You may obtain a copy 
* of the License at http://www.apache.org/licenses/LICENSE-2.0  
* 
* THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 
* WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 
* MERCHANTABLITY OR NON-INFRINGEMENT. 
*
* See the Apache License, Version 2.0 for specific language governing 
* permissions and limitations under the License.
*
*/
#pragma once

#include <baja/graphics/dx11.1/details/common.hpp>

namespace baja { namespace graphics { namespace dx11_1 { namespace details {

// helper method to populate a viewport from a D3D11_VIEWPORT
inline viewport toBajaViewport(const D3D11_VIEWPORT& d3dViewport)
{
    viewport vp;
    vp.position.x = d3dViewport.TopLeftX;
    vp.position.y = d3dViewport.TopLeftY;
    vp.width = d3dViewport.Width;
    vp.height = d3dViewport.Height;
    vp.minZ = d3dViewport.MinDepth;
    vp.maxZ = d3dViewport.MaxDepth;
    return vp;
}

// helper method to populate a D3D11_VIEWPORT from a viewport
inline D3D11_VIEWPORT toD3D11_VIEWPORT(const viewport& vp)
{
    D3D11_VIEWPORT d3dViewport;
    d3dViewport.TopLeftX = vp.position.x;
    d3dViewport.TopLeftY = vp.position.y;
    d3dViewport.Width = vp.width; 
    d3dViewport.Height = vp.height;
    d3dViewport.MinDepth = vp.minZ;
    d3dViewport.MaxDepth = vp.maxZ;
    return d3dViewport;
}

struct texture_interfaces
{
    static const size_t iunknown = 0;
    static const size_t undordered_access = 1;
    static const size_t shader_resource = 2;
    static const size_t render_target = 3;
    static const size_t depth_stencil = 4;
};

struct graphics_interfaces
{
    static const size_t d3d_device_context = 0;
    static const size_t swap_chain = 1;
    static const size_t d2d_device_context = 2;
    static const size_t d2d_factory = 3;
    static const size_t d2d_state_block = 4;
    static const size_t d3d_device = 6;
    static const size_t d3d_device_context_deferred = 7;
};

}}}} // namespace baja.graphics.dx11_1.details
